﻿using System.Runtime.InteropServices;
using System.Text;

namespace Struct
{
    // 接受参数用的结构体 详情见：https://learn.microsoft.com/zh-cn/windows/win32/api/windef/ns-windef-rect
    [StructLayout(LayoutKind.Sequential)]
    public struct RECT
    {
        int left;
        int top;
        int right;
        int bottom;

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("{");
            sb.Append("\"left\":"); sb.Append(left.ToString()); sb.Append(",");
            sb.Append("\"top\":"); sb.Append(top.ToString()); sb.Append(",");
            sb.Append("\"right\":"); sb.Append(right.ToString()); sb.Append(",");
            sb.Append("\"bottom\":"); sb.Append(bottom.ToString()); sb.Append(",");
            sb.Append("}");
            return sb.ToString();
        }
    }
}
